﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class LocationAdjustmentUIRule
    {
        private static LocationAdjustmentUIRule _NewInstance = new LocationAdjustmentUIRule();

        public static LocationAdjustmentUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new LocationAdjustmentUIRule();
                }

                return _NewInstance;
            }
        }

        public ResultModel < List<LocationGoodsInfo>> GetLocationGoodsInfo(string userID)
        {
            try
            {
                ResultModel<List<LocationGoodsInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsInfo>>>("GetLocationGoodsInfo", new object[] { userID });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsInfo>>().GetInstance();
            }
          
        }

        public ResultModel < List<LocationGoodsBatchInfo>> GetLocationGoodsBatchInfo(string userID)
        {
            try
            {
                ResultModel<List<LocationGoodsBatchInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsBatchInfo>>>("GetLocationGoodsBatchInfo", new object[] { userID });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsBatchInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsBatchInfo>>().GetInstance();
            }
        ;
        }

        public ResultModel<bool> Submit(string userID, List<LocationInventoryInfo> lstLocationInventory)
        {
            try
            {
                ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationAdjustment>.NewInstance.InvokeWebMethod<List<LocationInventoryInfo>, ResultModel<bool>>("Submit", new object[] { userID }, lstLocationInventory);
                if (_result == null)
                    return new ResultModel<bool>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<bool>().GetInstance();
            }
           
        }
    }
}
